package com.ihd.ihardware.common.adapter;

/**
 * Created by 84429 on 2017/7/4.
 */

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.ihd.ihardware.pojo.Test_rp;

import java.util.List;

public class FragmentAdapter extends FragmentStatePagerAdapter {
    private List<Fragment> mFragments;
    private List<Test_rp> mTitles;

    public FragmentAdapter(FragmentManager fm, List<Fragment> fragments, List<Test_rp> titles) {
        super(fm);
        mFragments = fragments;
        mTitles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (mTitles.get(position).getType()) {
            case 1:
                return "肥胖度";
            case 2:
                return "BMI";
            case 3:
                return "体脂率";
            case 4:
                return "脂肪重量";
            case 5:
                return "骨骼肌率";
            case 6:
                return "肌肉率";
            case 7:
                return "肌肉率";
            case 8:
                return "肌肉重量";
            case 9:
                return "内脏脂肪";
            case 10:
                return "水份";
            case 11:
                return "水含量";
            case 12:
                return "基础代谢";
            case 13:
                return "骨量";
            case 14:
                return "蛋白质";
            case 15:
                return "去脂体重";
            case 16:
                return "身体年龄";
            case 17:
                return "体重";
            default:
                return "";
        }
    }
}
